package ch.ethz.inf.vs.sunspot.security;

import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;

import ch.ethz.inf.vs.sunspot.commons.JerseyConstants;

/**
 * 
 * @author ch.ethz.inf.vs.wot.autowot.builders.java.JerseyJavaBuilder
 *
 */

public class UnauthorizedException extends WebApplicationException {

	private static final long serialVersionUID = 1L;

	public UnauthorizedException() {
			super(Response.status(Status.UNAUTHORIZED).header("WWW-Authenticate", JerseyConstants.getAuthChallengeString(null, null)).build());
	}
	
	public UnauthorizedException(String nonce, String opaque) {
		super(Response.status(Status.UNAUTHORIZED).header("WWW-Authenticate", JerseyConstants.getAuthChallengeString(nonce, opaque)).build());
	}
}
